﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

using System.IO;
using System.Runtime.Serialization;
using System.Xml.Serialization;

namespace GeneralDefine
{
    public enum MotionDir
    {
        CW,
        CCW
    }
    public enum HomeMode
    {
        LIMIT_NEAR_ORG,
        LIMIT_NEAR_ORG_Z,
        LIMIT_ORG,
        LIMIT_ORG_Z,
        NEAR_ORG,
        NEAR_ORG_Z,
        ORG,
        ORG_Z
    }
    public enum AxisName
    {
        X,
        Y,
        Z,
        U,
        V,
        W
    }
    /// <summary>
    /// dAcc单位是plus/s2
    /// </summary>
    [XmlInclude(typeof(MotionSpeed))]
    public struct MotionSpeed
    {
        public double dAcc;
        public double dDec;
        public double iStartSpeed;
        public double iMoveSpeed;
        public double iEndSpeed;
    }
    public interface IMotion
    {
        bool GetCmdPos(int iAxis,out double iPos);
        bool SetCmdPos(int iAxis, double iPos);
        bool GetPos(int iAxis, out double iPos);
        bool SetPos(int iAxis, double iPos);

        bool GetHome(int iAxis);
        bool GetAlarm(int iAxis);
        bool GetServoOn(int iAxis);
        bool GetCWL(int iAxis);
        bool GetCCWL(int iAxis);
        bool MoveDone(int iAxis);

        bool StopALL();
        bool Stop(int iAxis);

        bool EstopALL();
        bool EstopStop(int iAxis);

        bool SetServoOn(int iAxis,bool bOn);

        bool RsAlarm(int iAxis);

        bool SetCompareOutPut(int[] iAxises, double[] iPoses, int iOutPort);
        bool ResetCompareOutPut(int[] iAxises);

        bool SetCatchPosInput(int iChanel,int inputChanel,int iAixsNo,bool bRaisedEdge);
        bool ResetCatchPosInput(int iChanel);
        bool GetCatchPos(int iChanel,out double iAxisPos);
        /// <summary>
        /// 
        /// </summary>
        /// <param name="iAxis"></param>
        /// <param name="speed"></param>
        /// <returns></returns>
        bool SetSpd(int iAxis,MotionSpeed speed);
        bool Jog(int iAxis,MotionDir dir);
        bool Home(int iAxis, MotionDir dir,HomeMode homeMode);

        bool AbsMoveSigle(int iAxis, double iPos);
        bool RelMoveSigle(int iAxis, double iPos);

        bool ABSMove(int[] iAxis, double[] iPos);
        bool RelMove(int[] iAxis, double[] iPos);
        bool ABSGo(int[] iAxis, double[] iPos);
        bool RelGo(int[] iAxis, double[] iPos);
        bool ABSJump(int[] iAxis, double[] iPos);
        bool RelJump(int[] iAxis, double[] iPos);

        bool ABSArc(int[] iAxis, double[] iStart, double[] iMid, double[] iEnd,bool bCW);
        bool ABSArc(int[] iAxis, double[] iStart, double[] Center, double dAngel);
        bool InitCure(int group);
        bool SetCureSpd(int group, MotionSpeed speed);
        bool PushLineToCure(int group, double[] iPos);
        bool PushArcToCure(int group, double[] iStart, double[] iMid, double[] iEnd,bool bCW,double dSweeAngle);
        bool PushArcToCure(int group, double[] iStart, double[] Center, double dAngel);
        bool PushExtDo(int group, int iChannal, int iOnOff);
        bool PushDelay(int group, int iDelayTimeMs);
        bool StartCure(int group);
        bool GetCureStatus(int group,out bool bMoveDone,out int iItemActioned);
    }
}
